import { Engine } from '../engine/engine.js'

export class PermissionUtil {
    /**
     * 静态方法：按设定参数过滤菜单
     * @param {Object} menuData
     * @returns {boolean}
     */
    static filterMenuByOrgSettings(menuData) {
        const orgSettings = Engine.getOrgSettings()

        if (
            !orgSettings.multiStoreMode &&
            (menuData.code === 'M_EnterpriseMgt_Org_StoreMgt' ||
                menuData.funCode === 'F_EnterpriseMgt_Org_StoreMgt')
        ) {
            return true
        }

        if (
            !orgSettings.enableMultiWarehouse &&
            (menuData.code === 'M_Inventory_Mgr_Wares' ||
                menuData.funCode === 'F_WareMgr')
        ) {
            return true
        }

        return false
    }
}
